<?php
    /**
     * First check if an installation exists and is valid and then send user
     * to further installation procedure or to the login page.
     */

    @include "serverCheck.inc";
    if($db) {                                   //the server has already been setup
        @include "adminCheck.inc";
        if($user)                               //at least one admin is setup in the database
            header("location: $gotoPage");      //The installation is valid and the user should login or go to finish.
        else
            header("location: setupAdmin.php"); //the server is setup but no admin has been entered
    } else {
        header("location: $gotoPage");          //no installation exists so far so install or checks should be called.
    }
?>
